package com.easycode.devtool.web;

/**
 * Created by Administrator on 2015/6/15.
 */


import com.easycode.devtool.util.CommonUtils;
import com.easycode.devtool.util.DESUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 */

@RestController
public class PswController {

    /**
     * 消息提示功能页
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="/tool/psw.do")
    public ModelAndView psw(HttpServletRequest request, HttpServletResponse response)
    {
        ModelAndView mav = new ModelAndView("error/psw");

        if(request.getMethod().equalsIgnoreCase("get"))
        {
            return mav;
        }
        else {

            String sjm = CommonUtils.getStringValue(request.getParameter("sjm"));
            String psw = CommonUtils.getStringValue(request.getParameter("psw"));
            try {
                String pswTxt = DESUtils.encrypt(sjm,psw);
                mav.addObject("pswTxt",pswTxt);
            } catch (Exception e) {
                e.printStackTrace();
            }

        }


        return mav;
    }
}
